home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / ip / dialupip / dialupip2.0.patch.1 / text0000.txt < prev   
Encoding:
Text File  |  1991-02-11  |  6.9 KB  |  239 lines

  1. Patch #1 to dialupip 2.0 changes the following routines:
  2.  
  3. dulib/log.c    Corrects output and possible address specification
  4.         error when using log formats with "%x" (hex) symbol.
  5.  
  6. dumisc/duioctl.c
  7.         Corrects output and possible address specification
  8.         error when setting SOFTTIMER.
  9.  
  10. diald/diald.c    Adds logging of packet source, destination, and protocol
  11.         causing line activation.
  12.         Improve readability of log messages.
  13.         Remove spurious "diald exiting" messages.
  14.  
  15. While dialupip will work fine without this patch, it's installation makes
  16. debugging dialupip services easier.
  17.  
  18. /John
  19.  
  20. ====== patch follows =====
  21. *** /tmp/,RCSt1a20184    Mon Feb 11 09:23:21 1991
  22. --- log.c    Fri Feb  8 15:49:43 1991
  23. ***************
  24. *** 99,105 ****
  25.           break;
  26.           case 'o': case 'c': case 'd': case 's': case 'u':
  27.           case 'e': case 'E': case 'f': case 'g': case 'G':
  28. !         case 'm':
  29.           done++;
  30.           /* FALLTHROUGH */
  31.           case ' ': case '+': case '-': case '.': case '#':
  32. --- 99,105 ----
  33.           break;
  34.           case 'o': case 'c': case 'd': case 's': case 'u':
  35.           case 'e': case 'E': case 'f': case 'g': case 'G':
  36. !         case 'm': case 'x':
  37.           done++;
  38.           /* FALLTHROUGH */
  39.           case ' ': case '+': case '-': case '.': case '#':
  40. *** /tmp/,RCSt1a20189    Mon Feb 11 09:23:22 1991
  41. --- duioctl.c    Fri Feb  8 15:54:20 1991
  42. ***************
  43. *** 175,181 ****
  44.           fatal("Can't SIOCSATIMEO");
  45.           d_log(DLOG_GENERAL, WHERE, "Set ATIMEO on \"%s\" to %d",
  46.           device, i);
  47. !         (void)printf("Set ATIMEO to %d\n", s);
  48.       }
  49.       else if (EQ(*argv, "SWTIMEO")) {
  50.           i = getnumber(argv[0], argv[1]);
  51. --- 175,181 ----
  52.           fatal("Can't SIOCSATIMEO");
  53.           d_log(DLOG_GENERAL, WHERE, "Set ATIMEO on \"%s\" to %d",
  54.           device, i);
  55. !         (void)printf("Set ATIMEO to %d\n", i);
  56.       }
  57.       else if (EQ(*argv, "SWTIMEO")) {
  58.           i = getnumber(argv[0], argv[1]);
  59. ***************
  60. *** 194,200 ****
  61.           if (ioctl(s, SIOCSSOFTTIMER, (caddr_t)&ifr) < 0)
  62.           fatal("Can't SIOCSSOFTTIMER");
  63.           d_log(DLOG_GENERAL, WHERE, "Set SOFTTIMER on \"%s\" to %d",
  64. !         i, device);
  65.           (void)printf("Set SOFTTIMER to %d\n", i);
  66.       }
  67.       else if (EQ(*argv, "ENABLECALL")) {
  68. --- 194,200 ----
  69.           if (ioctl(s, SIOCSSOFTTIMER, (caddr_t)&ifr) < 0)
  70.           fatal("Can't SIOCSSOFTTIMER");
  71.           d_log(DLOG_GENERAL, WHERE, "Set SOFTTIMER on \"%s\" to %d",
  72. !         device, i);
  73.           (void)printf("Set SOFTTIMER to %d\n", i);
  74.       }
  75.       else if (EQ(*argv, "ENABLECALL")) {
  76. *** /tmp/,RCSt1a20194    Mon Feb 11 09:23:24 1991
  77. --- diald.c    Fri Feb  8 15:56:28 1991
  78. ***************
  79. *** 84,102 ****
  80.       register REMOTE        *rp;
  81.       register struct du_pkt    *pkt;
  82.   {
  83. !     register int        i;
  84.       register TABLE        *tp;
  85.       struct timeval        tv;
  86.       struct tm            *tm;
  87.   
  88.       /* check protocol */
  89. !     i = pkt->du_ip.ip_p;
  90. !     if ((rp->Protocols[P_WORD(i)] & P_BIT(i)) == 0) {
  91. !     for (tp = ProtocolNames; tp->Name; tp++)
  92. !         if (i == tp->Protocol)
  93. !         break;
  94. !     d_log(DLOG_INFO, WHERE, "Bad protocol %s (%d)",
  95. !         tp ? tp->Name : "unknown");
  96.       return 0;
  97.       }
  98.   
  99. --- 84,106 ----
  100.       register REMOTE        *rp;
  101.       register struct du_pkt    *pkt;
  102.   {
  103. !     register int        pnum;
  104.       register TABLE        *tp;
  105. +     char             *pname;
  106. +     char            srcaddr[20];
  107.       struct timeval        tv;
  108.       struct tm            *tm;
  109.   
  110. +     pnum = pkt->du_ip.ip_p;
  111. +     for (tp = ProtocolNames; tp->Name; tp++)
  112. +         if (pnum == tp->Protocol)
  113. +         break;
  114. +     pname = tp ? tp->Name :  "unknown";
  115.       /* check protocol */
  116. !     if ((rp->Protocols[P_WORD(pnum)] & P_BIT(pnum)) == 0) {
  117. !     d_log(DLOG_INFO, WHERE, "Unauthorized protocol %s (%d)",
  118. !         pname, pnum);
  119.       return 0;
  120.       }
  121.   
  122. ***************
  123. *** 110,130 ****
  124.       return 0;
  125.       }
  126.       if ((rp->Times[tm->tm_wday] & (1L << tm->tm_hour)) == 0) {
  127. !     d_log(DLOG_INFO, WHERE, "Bad time to call");
  128.       return 0;
  129.       }
  130.   
  131.       /* Check addresses. */
  132.       if (rp->AllowCount && !hostinlist(rp->AllowTo, pkt->du_ip.ip_dst)) {
  133. !     d_log(DLOG_INFO, WHERE, "Bad destination address \"%s\"",
  134.           inet_ntoa(pkt->du_ip.ip_dst));
  135.       return 0;
  136.       }
  137.       if (rp->DisallowCount && hostinlist(rp->DisallowFrom, pkt->du_ip.ip_src)) {
  138. !     d_log(DLOG_INFO, WHERE, "Bad source address \"%s\"",
  139.           inet_ntoa(pkt->du_ip.ip_src));
  140.       return 0;
  141.       }
  142.   
  143.       /* o.k. to make call */
  144.       return 1;
  145. --- 114,138 ----
  146.       return 0;
  147.       }
  148.       if ((rp->Times[tm->tm_wday] & (1L << tm->tm_hour)) == 0) {
  149. !     d_log(DLOG_INFO, WHERE, "Unauthorized time of day");
  150.       return 0;
  151.       }
  152.   
  153.       /* Check addresses. */
  154.       if (rp->AllowCount && !hostinlist(rp->AllowTo, pkt->du_ip.ip_dst)) {
  155. !     d_log(DLOG_INFO, WHERE, "Unauthorized destination address \"%s\"",
  156.           inet_ntoa(pkt->du_ip.ip_dst));
  157.       return 0;
  158.       }
  159.       if (rp->DisallowCount && hostinlist(rp->DisallowFrom, pkt->du_ip.ip_src)) {
  160. !     d_log(DLOG_INFO, WHERE, "Unauthorized source address \"%s\"",
  161.           inet_ntoa(pkt->du_ip.ip_src));
  162.       return 0;
  163.       }
  164. +     (void)sprintf(srcaddr, "%s", inet_ntoa(pkt->du_ip.ip_src));
  165. +     d_log(DLOG_INFO, WHERE, "Authorized packet [%s -> %s], proto %s (%d)",
  166. +        srcaddr, inet_ntoa(pkt->du_ip.ip_dst), pname, pnum);
  167.   
  168.       /* o.k. to make call */
  169.       return 1;
  170. ***************
  171. *** 260,266 ****
  172.       if ((i = read(f, (char *)&pkt, sizeof pkt)) != sizeof pkt) {
  173.           if (errno != EINTR)
  174.           d_log(DLOG_GENERAL, WHERE,
  175. !             "Bad read (%d bytes) from \"%s\", %m",
  176.               i, DEVDIAL);
  177.           continue;
  178.       }
  179. --- 268,274 ----
  180.       if ((i = read(f, (char *)&pkt, sizeof pkt)) != sizeof pkt) {
  181.           if (errno != EINTR)
  182.           d_log(DLOG_GENERAL, WHERE,
  183. !             "failed read (%d bytes) from \"%s\", %m",
  184.               i, DEVDIAL);
  185.           continue;
  186.       }
  187. ***************
  188. *** 268,282 ****
  189.       /* Find config data for the address. */
  190.       (void)sprintf(buff, "%s%d", pkt.du_ifname, pkt.du_ifunit);
  191.       if ((rp = findconfig(buff)) == NULL) {
  192. !         d_log(DLOG_GENERAL, WHERE, "Address %s not configured",
  193. !         inet_ntoa(pkt.du_sin.sin_addr));
  194.           continue;
  195.       }
  196.   
  197.       /* Is this packet is authorized? */
  198.       if (pkt.du_checkit && !authorized(rp, &pkt)) {
  199. !         (void)sprintf(buff, "%s not authorized to reach %s",
  200. !             inet_ntoa(pkt.du_ip.ip_src), inet_ntoa(pkt.du_ip.ip_dst));
  201.           failcall(rp->Device, buff);
  202.           continue;
  203.       }
  204. --- 276,289 ----
  205.       /* Find config data for the address. */
  206.       (void)sprintf(buff, "%s%d", pkt.du_ifname, pkt.du_ifunit);
  207.       if ((rp = findconfig(buff)) == NULL) {
  208. !         d_log(DLOG_GENERAL, WHERE, "Interface \"%s\" not configured",
  209. !         buff);
  210.           continue;
  211.       }
  212.   
  213.       /* Is this packet is authorized? */
  214.       if (pkt.du_checkit && !authorized(rp, &pkt)) {
  215. !         (void)sprintf(buff, "access controls");
  216.           failcall(rp->Device, buff);
  217.           continue;
  218.       }
  219. ***************
  220. *** 289,295 ****
  221.       if ((i = fork()) == 0) {
  222.           (void)setpgrp(0, getpgrp(0));
  223.           makecall(rp);
  224. !         break;
  225.       }
  226.       if (i < 0)
  227.           d_log(DLOG_GENERAL, WHERE, "Can't fork dialing process, %m");
  228. --- 296,302 ----
  229.       if ((i = fork()) == 0) {
  230.           (void)setpgrp(0, getpgrp(0));
  231.           makecall(rp);
  232. !         exit(0);
  233.       }
  234.       if (i < 0)
  235.           d_log(DLOG_GENERAL, WHERE, "Can't fork dialing process, %m");
  236.  
  237.